import facade


class SqlDealUtils(object):

    def __init__(self):
        self.logger = facade.get_streamlogger()
        # sqlite3 链接工具
        self.sqlite3utiles = facade.Sqlite3Utiles(logger=self.logger)
        self.mysqlutiles = None
        self.config_file = ""

    def conn_sqlite3(self, dbfilepath):
        """
        通过文件连接sqlit3
        """
        return self.sqlite3utiles.Sqlite3DBConnectFromFilePath(dbfilepath)

    def conn_mysql(self, sesc="mysql", builder="MysqlBuilder"):
        self.mysqlutiles = facade.MysqlUtiles(self.config_file, sesc, logger=self.logger, builder=builder)

    def set_config_file(self, configfile):
        self.config_file = configfile


